﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Blo
{
    public class DictMineBlo
    {
        public static TableMineSkill GetTableMineSkill(string id)
        {
            return Dict.DictDataManager.Instance.tableMineSkillDao.GetById(id);
        }

        public static List<TableMineSkill> GetMineByColorAndLevel(int color,int level)
        {
            List<TableMineSkill> magicList = Dict.DictDataManager.Instance.tableMineSkillDao.GetByOneIndex(UI.MineItemType.MAGICGEM);
            List<TableMineSkill> list = new List<TableMineSkill>();
            foreach (var m in magicList)
            {
                if (m.Level == level && m.Color == color)
                    list.Add(m);
            }

            return list;
        }


        public static List<TableMineSkill> GetStoneByQuality(int quality)
        {
            List<TableMineSkill> stoneList = Dict.DictDataManager.Instance.tableMineSkillDao.GetByOneIndex(UI.MineItemType.STONE);
            List<TableMineSkill> list = new List<TableMineSkill>();
            foreach (var m in stoneList)
            {
                if (m.Quality == quality)
                    list.Add(m);
            }

            return list;
        }

        public static List<TableMineSkill> GetMagicGemListByLevel(int level)
        {
            List<TableMineSkill> magicList = Dict.DictDataManager.Instance.tableMineSkillDao.GetByOneIndex(UI.MineItemType.MAGICGEM);
            List<TableMineSkill> list = new List<TableMineSkill>();
            foreach(var m in magicList)
            {
                if (m.Level == level)
                    list.Add(m);
            }

            return list;
        }

        public static int GetLevelExp(int level)
        {
            TableGemMakeLevelup levelup = Dict.DictDataManager.Instance.tableGemMakeLevelupDao.GetById(level);
            if (levelup != null)
                return levelup.exp;
            return 0;
        }
    }
}


